
from api.login_user import user_login

import unittest


class Yun_login(unittest.TestCase):
    def test_001(self):
        username= "peter"
        password = "admin"
        po ='Authenticate successfully'
        data = (username,password)
        self.assertEqual(data["message"],po)



    def test_002(self):
        #准备请求数据和断言数据
        username = "peter"
        password = "123456"
        code = 4

        #获取requests请求以后的json数据
        json_data = user_login(username,password)

        self.assertEqual(int(json_data["result"]),code)

    #用户名不存在的用例
    def test_003(self):
        #准备请求数据和断言数据
        username = "peter1"
        password = "123456"
        code = 5

        #获取requests请求以后的json数据
        json_data = user_login(username,password)

        self.assertEqual(int(json_data["result"]),code)

